<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>成品车辆查询</title>
    <script src="util.js"></script>
    <script src="req.js"></script>
    <script src="flexible.min.js"></script>
    <style>
        * {
            background-color: #eee;
            font-size: 20px;
        }

        table {
            background-color: #fff;
            width: 100%;
            text-align: center;
        }

        img {
            width: 20px;
        }
    </style>
</head>

<body>
    <div id="box">
        <table>
            <thead>
                <tr>
                    <th>ID</th>
                    <th>车辆类型</th>
                    <th>数量</th>
                    <th>占地面积</th>
                    <th> 生产线</th>
                    <th>合格</th>
                </tr>
            </thead>
            <tbody></tbody>
        </table>
    </div>
    <script>
        var tbodyHtml = "";
        JQ("http://192.168.1.101:8085/Interface/index/getUserNormalCarStoreAll")
            .then(e1 => {
                e1.data.forEach((item, index) => {
                    (item.type == 0) ? (e1.data[index].rate = "正常") : (e1.data[index].rate = "维修");
                    JQ("http://192.168.1.101:8085/dataInterface/Car/getInfo", { id: item.carTypeId })
                        .then(e2 => {
                            e1.data[index].carName = e2.data[0].carName;
                            JQ("http://192.168.1.101:8085/dataInterface/UserProductionLine/getInfo", { id: item.userLineId })
                                .then(e3 => {
                                    JQ("http://192.168.1.101:8085/dataInterface/ProductionLine/getInfo", { id: e3.data[0].productionLineId })
                                        .then(e4 => {
                                            e1.data[index].productionLineName = e4.data[0].productionLineName;
                                            html_data(item)
                                        })
                                })
                        })
                })
            })
        JQ("http://192.168.1.101:8085/Interface/index/getUserRepairCarStoreAll")
            .then(e1 => {
                e1.data.forEach((item, index) => {
                    (item.type == 0) ? (e1.data[index].rate = "正常") : (e1.data[index].rate = "维修");
                    JQ("http://192.168.1.101:8085/dataInterface/Car/getInfo", { id: item.carTypeId })
                        .then(e2 => {
                            e1.data[index].carName = e2.data[0].carName;
                            JQ("http://192.168.1.101:8085/dataInterface/UserProductionLine/getInfo", { id: item.userLineId })
                                .then(e3 => {
                                    JQ("http://192.168.1.101:8085/dataInterface/ProductionLine/getInfo", { id: e3.data[0].productionLineId })
                                        .then(e4 => {
                                            e1.data[index].productionLineName = e4.data[0].productionLineName;
                                            html_data(item)
                                        })
                                })
                        })
                })
            })
        function html_data(data) {
                tbodyHtml += `<tr>
                    <td>${data.id}</td>
                    <td>${data.carName}</td>
                    <td>${data.num}</td>
                    <td>${data.CarType.size}</td>
                    <td>${data.productionLineName}</td>
                    <td>${data.rate}</td>
                </tr>`;
            $('tbody').html(tbodyHtml)
        }


    </script>
</body>

</html>